package site.xuqing.autohelperengine.local.overlay;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import site.xuqing.autohelperengine.R;

/**
 * @author xuqing
 */
public class MessageView extends LinearLayout implements View.OnClickListener {
    TextView text;
    Button confirm;
    public MessageView(Context context) {
        this(context, null);
    }

    public MessageView(Context context,AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.float_message, this);

        text=findViewById(R.id.text);
        confirm=findViewById(R.id.confirm);
        confirm.setOnClickListener(this);
    }

    public void showMessage(String message){
        text.setText(message);
    }

    @Override
    public void onClick(View v){
        FloatViewManager.getInstance().hideMessageView();
    }
}
